<template>
  <div class="order">
    <div class="top">
      <div class="title">饿了么</div>
      <div class="opts">
        <span
          :class="{ active: optsIndex == index }"
          v-for="(item, index) in optslist"
          :key="index"
          @click="optsIndex = index"
        >
          {{ item }}
        </span>
      </div>
      <div class="orderlist">
        <div class="item" v-for="(item, index) in orderlist" :key="index">
          <div class="show-top">
            <div class="name">
              {{ item.name }}
            </div>
            <div class="status">
              {{ item.status }}
            </div>
          </div>
          <div class="show-middle">
            <div class="show-left">
                <div
              class="products"
              v-for="(it, it_index) in item.product"
              :key="it_index"
            >
              {{ it }}
            </div>
            </div>
            <div class="show-right">
                ￥<span class="price">
                    {{ item.price }}
                </span>
                <div class="count">
              {{ item.count }}
            </div>
            </div>            
          </div>
          <div class="show-bottom">
            <button>再来一单</button>
          </div>
        </div>
      </div>
    </div>
  </div>
</template>

<script>
export default {
  data() {
    return {
      optsIndex: 0,
      optslist: ["全部", "待消费", "待评价", "退款"],
      orderlist: [
        {
          name: "纯手工饺子(凤城九路店)",
          status: "已送达",
          product: ["1", "2"],
          price: 17.8,
          count: '共2件',
        },
        {
          name: "唐久便利(海荣名城店)",
          status: "已送达",
          product: ["1", "2", "3"],
          price: 18.3,
          count: '共3件',
        },
        {
          name: "美益水果(北美店)",
          status: "已送达",
          product: ["1", "2"],
          price: 28.89,
          count: '共2件',
        },
      ],
    };
  },
};
</script>

<style scoped>
.order {
  height: 550px;
  background-color: gainsboro;
}
.top {
  height: 80px;
}
.title {
  height: 40px;
  line-height: 40px;
  text-align: center;
  font-size: 14px;
  font-weight: 700;
}
.opts {
  height: 40px;
  line-height: 40px;
  padding: 0 16px;
}
.opts span {
  font-size: 14px;
  margin-right: 20px;
  cursor: pointer;
}
.opts .active {
  font-size: 16px;
  font-weight: 700;
}
.orderlist {
  height: 470px;
  padding: 0 10px;
  overflow-y: auto;
}
::-webkit-scrollbar{
    display: none;
}
.item {
  height: 160px;
  background-color: #fff;
  border-radius: 5px;
  margin-bottom: 5px;
  padding: 10px;
}
.show-top {
    height: 20px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
}
.name {
  font-weight: 700;
}
.status{
    font-size: 12px;
    color: gray;
}
.show-middle{
    height: 60px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
}
.show-left{
    display: flex;
}
.products{
    width: 60px;
    height: 60px;
    border: 1px solid;
    margin-right: 5px;
}
.show-right{
    font-size: 12px;
    text-align: right;
}
.price{
    font-size: 14px;
}
.count{
    color: gray;
    margin-top: 5px;
}
.show-bottom{
    text-align: right;
}
button{
    width: 80px;
    height: 30px;
    border-radius: 20px;
    color: rgb(7, 179, 237);
    border: 1px solid rgb(7, 179, 237);
    background-color: #fff;
}
</style>